package cn.ibizlab.odoo.core.odoo_purchase.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Ipurchase_report;
import cn.ibizlab.odoo.core.odoo_purchase.domain.Purchase_report;
import cn.ibizlab.odoo.core.odoo_purchase.filter.Purchase_reportSearchContext;
import cn.ibizlab.odoo.core.odoo_purchase.service.IPurchase_reportService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[采购报表] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Purchase_reportServiceImpl implements IPurchase_reportService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Ipurchase_reportClientService purchase_reportClientService;

    @Override
    public boolean update(Purchase_report purchase_report) {
        boolean bOk = false ;
        Ipurchase_report clientModel = this.convert2Model(purchase_report,null);
        purchase_reportClientService.update(clientModel) ;
        this.convert2Domain(clientModel,purchase_report) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public boolean create(Purchase_report purchase_report) {
        boolean bOk = false ;
        Ipurchase_report clientModel = this.convert2Model(purchase_report,null);
        purchase_reportClientService.create(clientModel) ;
        this.convert2Domain(clientModel,purchase_report);
        bOk = true ;

        return bOk ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Ipurchase_report clientModel = purchase_reportClientService.createModel();
        clientModel.setId(id);
        purchase_reportClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public Purchase_report get(Integer id) {
        Ipurchase_report clientModel = purchase_reportClientService.createModel();
        clientModel.setId(id);
        purchase_reportClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Purchase_report get(Purchase_report purchase_report) {
        Purchase_report retpurchase_report = this.get(purchase_report.getId()) ;
    	BeanCopier copier=BeanCopier.create(retpurchase_report.getClass(), purchase_report.getClass(), false);
        copier.copy(retpurchase_report, purchase_report, null);
        return purchase_report ;
    }

    @Override
    public void createBatch(List<Purchase_report> purchase_reports, int batchSize) {

                        //purchase_reportClientService.createBatch(purchase_reports,batchSize) ;

    }

    @Override
    public void updateBatch(List<Purchase_report> purchase_reports, int batchSize) {

        //purchase_reportClientService.updateBatch(purchase_reports,batchSize) ;

    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //purchase_reportClientService.removeBatch(purchase_reports) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Purchase_report> searchDefault(Purchase_reportSearchContext context) {
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据分析账户查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_account_analytic(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据税科目调整查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_fiscal_position(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品种类查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_category(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_product(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品模板查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_product_tmpl(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_company(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据国家/地区查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_country(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据币种查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_currency(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_commercial_partner(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_partner(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_user(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据仓库查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_picking_type(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据产品计量单位查询
     */
    @Override
    public Page<Purchase_report> selectByOdoo_product_uom(Integer id){
        Purchase_reportSearchContext context = new Purchase_reportSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Purchase_report> list = new ArrayList<Purchase_report>();
        Page<cn.ibizlab.odoo.core.client.model.Ipurchase_report> clientModelList = purchase_reportClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ipurchase_report clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Purchase_report>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Ipurchase_report convert2Model(Purchase_report domain , Ipurchase_report model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = purchase_reportClientService.createModel() ;
        }

         if(domain.getDelay_passDirtyFlag())
            model.setDelay_pass(domain.getDelay_pass());
         if(domain.getDate_approveDirtyFlag())
            model.setDate_approve(domain.getDate_approve());
         if(domain.getVolumeDirtyFlag())
            model.setVolume(domain.getVolume());
         if(domain.getNbr_linesDirtyFlag())
            model.setNbr_lines(domain.getNbr_lines());
         if(domain.getNegociationDirtyFlag())
            model.setNegociation(domain.getNegociation());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getPrice_totalDirtyFlag())
            model.setPrice_total(domain.getPrice_total());
         if(domain.getWeightDirtyFlag())
            model.setWeight(domain.getWeight());
         if(domain.getDate_orderDirtyFlag())
            model.setDate_order(domain.getDate_order());
         if(domain.getPrice_averageDirtyFlag())
            model.setPrice_average(domain.getPrice_average());
         if(domain.getDelayDirtyFlag())
            model.setDelay(domain.getDelay());
         if(domain.getUnit_quantityDirtyFlag())
            model.setUnit_quantity(domain.getUnit_quantity());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getPrice_standardDirtyFlag())
            model.setPrice_standard(domain.getPrice_standard());
         if(domain.getCategory_id_textDirtyFlag())
            model.setCategory_id_text(domain.getCategory_id_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getCurrency_id_textDirtyFlag())
            model.setCurrency_id_text(domain.getCurrency_id_text());
         if(domain.getProduct_tmpl_id_textDirtyFlag())
            model.setProduct_tmpl_id_text(domain.getProduct_tmpl_id_text());
         if(domain.getCountry_id_textDirtyFlag())
            model.setCountry_id_text(domain.getCountry_id_text());
         if(domain.getPicking_type_id_textDirtyFlag())
            model.setPicking_type_id_text(domain.getPicking_type_id_text());
         if(domain.getFiscal_position_id_textDirtyFlag())
            model.setFiscal_position_id_text(domain.getFiscal_position_id_text());
         if(domain.getAccount_analytic_id_textDirtyFlag())
            model.setAccount_analytic_id_text(domain.getAccount_analytic_id_text());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getCommercial_partner_id_textDirtyFlag())
            model.setCommercial_partner_id_text(domain.getCommercial_partner_id_text());
         if(domain.getProduct_uom_textDirtyFlag())
            model.setProduct_uom_text(domain.getProduct_uom_text());
         if(domain.getProduct_id_textDirtyFlag())
            model.setProduct_id_text(domain.getProduct_id_text());
         if(domain.getCategory_idDirtyFlag())
            model.setCategory_id(domain.getCategory_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
         if(domain.getPicking_type_idDirtyFlag())
            model.setPicking_type_id(domain.getPicking_type_id());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
         if(domain.getCommercial_partner_idDirtyFlag())
            model.setCommercial_partner_id(domain.getCommercial_partner_id());
         if(domain.getProduct_tmpl_idDirtyFlag())
            model.setProduct_tmpl_id(domain.getProduct_tmpl_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getProduct_idDirtyFlag())
            model.setProduct_id(domain.getProduct_id());
         if(domain.getProduct_uomDirtyFlag())
            model.setProduct_uom(domain.getProduct_uom());
         if(domain.getCountry_idDirtyFlag())
            model.setCountry_id(domain.getCountry_id());
         if(domain.getFiscal_position_idDirtyFlag())
            model.setFiscal_position_id(domain.getFiscal_position_id());
         if(domain.getAccount_analytic_idDirtyFlag())
            model.setAccount_analytic_id(domain.getAccount_analytic_id());
        return model ;
    }

    public Purchase_report convert2Domain( Ipurchase_report model ,Purchase_report domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Purchase_report();
        }

        if(model.getDelay_passDirtyFlag())
            domain.setDelay_pass(model.getDelay_pass());
        if(model.getDate_approveDirtyFlag())
            domain.setDate_approve(model.getDate_approve());
        if(model.getVolumeDirtyFlag())
            domain.setVolume(model.getVolume());
        if(model.getNbr_linesDirtyFlag())
            domain.setNbr_lines(model.getNbr_lines());
        if(model.getNegociationDirtyFlag())
            domain.setNegociation(model.getNegociation());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getPrice_totalDirtyFlag())
            domain.setPrice_total(model.getPrice_total());
        if(model.getWeightDirtyFlag())
            domain.setWeight(model.getWeight());
        if(model.getDate_orderDirtyFlag())
            domain.setDate_order(model.getDate_order());
        if(model.getPrice_averageDirtyFlag())
            domain.setPrice_average(model.getPrice_average());
        if(model.getDelayDirtyFlag())
            domain.setDelay(model.getDelay());
        if(model.getUnit_quantityDirtyFlag())
            domain.setUnit_quantity(model.getUnit_quantity());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getPrice_standardDirtyFlag())
            domain.setPrice_standard(model.getPrice_standard());
        if(model.getCategory_id_textDirtyFlag())
            domain.setCategory_id_text(model.getCategory_id_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getCurrency_id_textDirtyFlag())
            domain.setCurrency_id_text(model.getCurrency_id_text());
        if(model.getProduct_tmpl_id_textDirtyFlag())
            domain.setProduct_tmpl_id_text(model.getProduct_tmpl_id_text());
        if(model.getCountry_id_textDirtyFlag())
            domain.setCountry_id_text(model.getCountry_id_text());
        if(model.getPicking_type_id_textDirtyFlag())
            domain.setPicking_type_id_text(model.getPicking_type_id_text());
        if(model.getFiscal_position_id_textDirtyFlag())
            domain.setFiscal_position_id_text(model.getFiscal_position_id_text());
        if(model.getAccount_analytic_id_textDirtyFlag())
            domain.setAccount_analytic_id_text(model.getAccount_analytic_id_text());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getCommercial_partner_id_textDirtyFlag())
            domain.setCommercial_partner_id_text(model.getCommercial_partner_id_text());
        if(model.getProduct_uom_textDirtyFlag())
            domain.setProduct_uom_text(model.getProduct_uom_text());
        if(model.getProduct_id_textDirtyFlag())
            domain.setProduct_id_text(model.getProduct_id_text());
        if(model.getCategory_idDirtyFlag())
            domain.setCategory_id(model.getCategory_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        if(model.getPicking_type_idDirtyFlag())
            domain.setPicking_type_id(model.getPicking_type_id());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        if(model.getCommercial_partner_idDirtyFlag())
            domain.setCommercial_partner_id(model.getCommercial_partner_id());
        if(model.getProduct_tmpl_idDirtyFlag())
            domain.setProduct_tmpl_id(model.getProduct_tmpl_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getProduct_idDirtyFlag())
            domain.setProduct_id(model.getProduct_id());
        if(model.getProduct_uomDirtyFlag())
            domain.setProduct_uom(model.getProduct_uom());
        if(model.getCountry_idDirtyFlag())
            domain.setCountry_id(model.getCountry_id());
        if(model.getFiscal_position_idDirtyFlag())
            domain.setFiscal_position_id(model.getFiscal_position_id());
        if(model.getAccount_analytic_idDirtyFlag())
            domain.setAccount_analytic_id(model.getAccount_analytic_id());
        return domain ;
    }


}
